import json


def User(param, param1):
    pass


userList = [User('Jerry','qwe'),User('小明','qwe'),User('Tom~',"678")]

jul = json.dumps(userList,default=User.json_d2)
print(jul)
f2 = open('test.json',"w")
f2.write(jul)